<!DOCTYPE HTML>
<html lang="pt-br" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	<h:head>
	
	<meta charset="UTF-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<meta name="description" content=""/>
	<meta name="author" content=""/>
	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate"/>
	<meta http-equiv="cache-control" content="post-check=0, pre-check=0" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />
	
	<link rel="icon" type="image/png" href="#{facesContext.externalContext.request.contextPath}/lib/imagem/logomarca.png"/>
	
	<link href="#{facesContext.externalContext.request.contextPath}/lib/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
	<link href="#{facesContext.externalContext.request.contextPath}/lib/css/bootstrap-theme.min.css" rel="stylesheet" media="screen"/>
	<link href="#{facesContext.externalContext.request.contextPath}/lib/css/principal.css" rel="stylesheet" media="screen"/>
	
	<title>Dallas Moto Peças</title>
	<script type="text/javascript">     
		PrimeFaces.locales['pt'] = {  
			closeText: 'Fechar',  
			prevText: 'Anterior',  
			nextText: 'Próximo',  
			currentText: 'Começo',  
			monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],  
			monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'],  
			dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'],  
			dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],  
			dayNamesMin: ['D','S','T','Q','Q','S','S'],  
			weekHeader: 'Semana',  
			firstDay: 0,  
			isRTL: false,  
			showMonthAfterYear: false,  
			yearSuffix: '',  
			timeOnlyTitle: 'Só Horas',  
			timeText: 'Tempo',  
			hourText: 'Hora',  
			minuteText: 'Minuto',  
			secondText: 'Segundo',  
			ampm: false,  
			month: 'Mês',  
			week: 'Semana',  
			day: 'Dia',  
			allDayText : 'Todo o Dia'  
		};
		 var chartStyle = {  
	             padding:20,  
	             legend: {  
	                 display:"right",  
	                 spacing:10  
	             }  
	         };
		 window.history.forward(1);
		 
		 function desabilitarEnter() 
			{
				var tecla = event.keyCode;
				if (tecla == 13){
					return false;
				}
				
				return true;
			}
	</script>
	
	<style type="text/css">
     	.ui-layout-north 
     	{
        	z-index:20 !important;
            	overflow:visible !important;;
		}
		.ui-layout-north .ui-layout-unit-content {
        	overflow:visible !important;
       	}
       	.colunaEsquerda
		{  
		    text-align: left;
		    width: 30%;  
		}  
		.colunaDireita
		{  
		    text-align: left;
		    width: 70%    
		}
	</style>
		
	</h:head>
	
	<h:body>
	
	<p:ajaxStatus onstart="PF('statusDialog').show();" 
				onsuccess="PF('statusDialog').hide();"/>
	
	<p:dialog modal="true" 
			widgetVar="statusDialog" 
			header="Aguarde"
			resizable="false"   
    		draggable="false" 
    		closable="false">  
    	<p:graphicImage value="/lib/imagem/gif-load.gif" /> 
	</p:dialog>
	
	<h:form id="frmPrincipal" onkeypress="return desabilitarEnter();">
	<p:growl id="mensagem" showDetail="true" autoUpdate="true" closable="true" />
	<p:layout fullPage="true">
	
		<p:layoutUnit position="north" >
			 <p:menubar>	
             	<p:submenu label="Módulos" icon="ui-icon-folder-open">
             	
                	<p:menuitem value="Vendas"
                				action="#{principalManagerBean.requisicaoPrincipal(1)}" 
                				disabled="#{!principalManagerBean.vd1}"/>
                	
                 	<p:menuitem value="Compras"
                 				action="#{principalManagerBean.requisicaoPrincipal(2)}" 
                 				disabled="#{!principalManagerBean.cp1}"/>
                 	
                 	<p:menuitem value="Clientes"
                 				action="#{principalManagerBean.requisicaoPrincipal(3)}" 
                 	           	disabled="#{!principalManagerBean.tr1}"/>
                 	
                    <p:menuitem value="Conhecimento"
                    			action="#{principalManagerBean.requisicaoPrincipal(4)}" 
                    			disabled="#{!principalManagerBean.cn1}"/>
                    
                    <p:menuitem value="Sistema" 
                    			action="#{principalManagerBean.requisicaoPrincipal(5)}"
                                disabled="#{!principalManagerBean.sg1}" />
                        
                 </p:submenu>
                 	<f:facet name="options">
						Bem Vindo: <h:outputText value="#{usuarioLogado.nomeCompleto}"/>
								   <h:outputText value="   "/>
						<p:splitButton value="Sair do Sistema"
									action="#{principalManagerBean.requisicaoPrincipal(20)}">
							<p:menuitem value="Alterar Senha" 
                    					actionListener="#{principalManagerBean.requisicaoPrincipal(21)}"/>
						</p:splitButton>
        			</f:facet>
			</p:menubar>
		</p:layoutUnit>
		
		<p:layoutUnit position="center"> 
           	<ui:insert name="corpo"/>      
    	</p:layoutUnit>
    	  
	</p:layout>
	
	<ui:insert name="modal"/>
	
	<p:dialog header="Alterar Senha" 
			widgetVar="alterarSenhaDialog" 
			modal="true"
			resizable="false" 
			width="530" 
			position="top" 
			closable="true">
		 <p:panel id="alterarSenhaPanel" 
    	 		style="font-size:12px;">
    	 <h:panelGrid id="pnlUsuario" 
    	 			columns="2"
    	 			columnClasses="colunaEsquerda, colunaDireita" 
					style="width:100%; border:none; font-size:11px;">
    	 			<h:outputLabel value="Senha" 
    	 						for="inputSenha"/>
					<p:password id="inputSenha"
								maxlength="50"
								style="width:100%"
								placeholder="Senha"
								validatorMessage="Senha e confirmação de senha devem ser iguais"
								value="#{principalManagerBean.usuarioVo.senha}"
								match="inputSenhaConfirmacao"/>
								
					<h:outputLabel value="Confirmação de Senha" 
								for="inputSenhaConfirmacao"/>
					<p:password id="inputSenhaConfirmacao"
								maxlength="50"
								size="50"
								placeholder="Confirmação de Senha"
								value="#{principalManagerBean.usuarioVo.senha}"/>
					
		</h:panelGrid>
		
		<div>
			<BR />
		</div>
		
		<p:commandButton id="btnAlterar" 
									value="Gravar" 
									styleClass="ui-priority-primary"
									actionListener="#{principalManagerBean.gravarUsuario}"/>
			
    	 </p:panel>
	</p:dialog>
	
	</h:form>  
	</h:body>
</html>